



           

using System;
using System.Collections.Generic;
using System.Web;
using System.Data.Common;
using Shohdi.DataHandler;
using System.Data;




namespace DatabaseComponent
{
    
    public partial class CoursesDB
    {
          //Write any additional methods or properties here 
          //Don't modify any genrated classes





        /// <summary>
        /// this function will delete the Courses
        /// </summary>
        /// <param name="con">a classdatahandler having the database connections</param>
        /// <param name="obj">an object of type Courses that have the ID to delete</param>
        /// <returns>true or false (succeed or error)</returns>
        public bool deleteAll(ClassDataHandler con, Courses obj)
        {
            obj.StatusID = 2;


            CoursesDB objCoursesDB = new CoursesDB();


            objCoursesDB.Update(con, obj);


            return true;


        }



        /// <summary>
        /// this function will delete the Courses
        /// </summary>
        /// <param name="obj">an object of type Courses that have the ID to delete</param>
        /// <returns>true or false (succeed or error)</returns>
        public bool deleteAll(Courses obj)
        {
            ClassDataHandler con = new ClassDataHandler(ConnectionStrings.LMS);
            con.OpenTransConnection(IsolationLevel.ReadUncommitted);
            bool bRet = false;
            try
            {

                bRet = deleteAll(con, obj);


                con.CommitTransConnection();

            }
            catch
            {
                con.RollbackTransConnection();
                return false;
            }


            return bRet;


        }







        ///// <summary>
        ///// this function will search by or and like for strings
        ///// </summary>
        ///// <param name="con">the handler having the database connection for transaction purposes</param>
        ///// <param name="obj">the object having the values to search for</param>
        ///// <returns>a list of courses matched</returns>
        //public List<Courses> SearchOrLike(ClassDataHandler con, Courses obj)
        //{
        //    string strWhere = "";
        //    List<DbParameter> lstParameters = new List<DbParameter>();


        //    if (obj.ID != -1)
        //    {
        //        DbParameter prmID = con.createParameter();
        //        prmID.ParameterName = "@ID";
        //        prmID.DbType = DbType.Int64;
        //        if (obj.ID == null)
        //        {
        //            prmID.Value = DBNull.Value;
        //        }
        //        else
        //        {
        //            prmID.Value = obj.ID;
        //        }
        //        strWhere += " [ID]=@ID OR ";
        //        lstParameters.Add(prmID);
        //    }





        //    if (obj.CourseNameEN != "")
        //    {
        //        DbParameter prmCourseNameEN = con.createParameter();
        //        prmCourseNameEN.ParameterName = "@CourseNameEN";
        //        prmCourseNameEN.DbType = DbType.String;
        //        if (obj.CourseNameEN == null)
        //        {
        //            prmCourseNameEN.Value = DBNull.Value;
        //        }
        //        else
        //        {
        //            prmCourseNameEN.Value = obj.CourseNameEN;
        //        }
        //        strWhere += " [CourseNameEN] LIKE @CourseNameEN OR ";
        //        lstParameters.Add(prmCourseNameEN);
        //    }





        //    if (obj.CourseNameAR != "")
        //    {
        //        DbParameter prmCourseNameAR = con.createParameter();
        //        prmCourseNameAR.ParameterName = "@CourseNameAR";
        //        prmCourseNameAR.DbType = DbType.String;
        //        if (obj.CourseNameAR == null)
        //        {
        //            prmCourseNameAR.Value = DBNull.Value;
        //        }
        //        else
        //        {
        //            prmCourseNameAR.Value = obj.CourseNameAR;
        //        }
        //        strWhere += " [CourseNameAR] LIKE @CourseNameAR OR ";
        //        lstParameters.Add(prmCourseNameAR);
        //    }





        //    if (obj.FolderID != -1)
        //    {
        //        DbParameter prmFolderID = con.createParameter();
        //        prmFolderID.ParameterName = "@FolderID";
        //        prmFolderID.DbType = DbType.Int64;
        //        if (obj.FolderID == null)
        //        {
        //            prmFolderID.Value = DBNull.Value;
        //        }
        //        else
        //        {
        //            prmFolderID.Value = obj.FolderID;
        //        }
        //        strWhere += " [FolderID]=@FolderID OR ";
        //        lstParameters.Add(prmFolderID);
        //    }





        //    if (obj.DateOfCreation != null)
        //    {
        //        DbParameter prmDateOfCreation = con.createParameter();
        //        prmDateOfCreation.ParameterName = "@DateOfCreation";
        //        prmDateOfCreation.DbType = DbType.DateTime;
        //        if (obj.DateOfCreation == null)
        //        {
        //            prmDateOfCreation.Value = DBNull.Value;
        //        }
        //        else
        //        {
        //            prmDateOfCreation.Value = obj.DateOfCreation;
        //        }
        //        strWhere += " [DateOfCreation]=@DateOfCreation OR ";
        //        lstParameters.Add(prmDateOfCreation);
        //    }





        //    if (obj.TargetAR != "")
        //    {
        //        DbParameter prmTargetAR = con.createParameter();
        //        prmTargetAR.ParameterName = "@TargetAR";
        //        prmTargetAR.DbType = DbType.String;
        //        if (obj.TargetAR == null)
        //        {
        //            prmTargetAR.Value = DBNull.Value;
        //        }
        //        else
        //        {
        //            prmTargetAR.Value = obj.TargetAR;
        //        }
        //        strWhere += " [TargetAR] LIKE @TargetAR OR ";
        //        lstParameters.Add(prmTargetAR);
        //    }





        //    if (obj.TargetEN != "")
        //    {
        //        DbParameter prmTargetEN = con.createParameter();
        //        prmTargetEN.ParameterName = "@TargetEN";
        //        prmTargetEN.DbType = DbType.String;
        //        if (obj.TargetEN == null)
        //        {
        //            prmTargetEN.Value = DBNull.Value;
        //        }
        //        else
        //        {
        //            prmTargetEN.Value = obj.TargetEN;
        //        }
        //        strWhere += " [TargetEN] LIKE @TargetEN OR ";
        //        lstParameters.Add(prmTargetEN);
        //    }





        //    if (obj.OutlineAR != "")
        //    {
        //        DbParameter prmOutlineAR = con.createParameter();
        //        prmOutlineAR.ParameterName = "@OutlineAR";
        //        prmOutlineAR.DbType = DbType.String;
        //        if (obj.OutlineAR == null)
        //        {
        //            prmOutlineAR.Value = DBNull.Value;
        //        }
        //        else
        //        {
        //            prmOutlineAR.Value = obj.OutlineAR;
        //        }
        //        strWhere += " [OutlineAR] LIKE @OutlineAR OR ";
        //        lstParameters.Add(prmOutlineAR);
        //    }





        //    if (obj.OutlineEN != "")
        //    {
        //        DbParameter prmOutlineEN = con.createParameter();
        //        prmOutlineEN.ParameterName = "@OutlineEN";
        //        prmOutlineEN.DbType = DbType.String;
        //        if (obj.OutlineEN == null)
        //        {
        //            prmOutlineEN.Value = DBNull.Value;
        //        }
        //        else
        //        {
        //            prmOutlineEN.Value = obj.OutlineEN;
        //        }
        //        strWhere += " [OutlineEN] LIKE @OutlineEN OR ";
        //        lstParameters.Add(prmOutlineEN);
        //    }





        //    if (obj.Duration != null)
        //    {
        //        DbParameter prmDuration = con.createParameter();
        //        prmDuration.ParameterName = "@Duration";
        //        prmDuration.DbType = DbType.Int64;
        //        if (obj.Duration == null)
        //        {
        //            prmDuration.Value = DBNull.Value;
        //        }
        //        else
        //        {
        //            prmDuration.Value = obj.Duration;
        //        }
        //        strWhere += " [Duration]=@Duration OR ";
        //        lstParameters.Add(prmDuration);
        //    }





        //    if (obj.Path != "")
        //    {
        //        DbParameter prmPath = con.createParameter();
        //        prmPath.ParameterName = "@Path";
        //        prmPath.DbType = DbType.String;
        //        if (obj.Path == null)
        //        {
        //            prmPath.Value = DBNull.Value;
        //        }
        //        else
        //        {
        //            prmPath.Value = obj.Path;
        //        }
        //        strWhere += " [Path]=@Path OR ";
        //        lstParameters.Add(prmPath);
        //    }





        //    if (obj.StatusID != -1)
        //    {
        //        DbParameter prmStatusID = con.createParameter();
        //        prmStatusID.ParameterName = "@StatusID";
        //        prmStatusID.DbType = DbType.Int64;
        //        if (obj.StatusID == null)
        //        {
        //            prmStatusID.Value = DBNull.Value;
        //        }
        //        else
        //        {
        //            prmStatusID.Value = obj.StatusID;
        //        }
        //        strWhere += " [StatusID]=@StatusID OR ";
        //        lstParameters.Add(prmStatusID);
        //    }






        //    if (strWhere != "")
        //        strWhere = " where " + strWhere.Substring(0, strWhere.LastIndexOf("OR"));





        //    List<Courses> lstRet = Select(con, "", strWhere, lstParameters.ToArray());

        //    return lstRet;
        //}

        ///// <summary>
        ///// this function will search by or and like for strings
        ///// </summary>
        ///// <param name="obj">the object having the values to search for</param>
        ///// <returns>a list of courses matched</returns>
        //public List<Courses> SearchOrLike(Courses obj)
        //{
        //    ClassDataHandler con = new ClassDataHandler(_Connection, _Provider);

        //    con.OpenConnection();

        //    List<Courses> lstRet = SearchOrLike(con, obj);

        //    con.CloseConnection();

        //    return lstRet;
        //}




    }

}

                        